import requests

# API 地址
url = "https://api.dify.ai/v1/datasets"

# 请求头
headers = {
    "Authorization": "Bearer {api_key}",  # 替换 {api_key} 为你的实际 API Key
    "Content-Type": "application/json"
}

# 请求数据
data = {
    "name": "name",          # 替换为实际数据集名称
    "permission": "only_me"  # 权限设置
}

# 发送 POST 请求
response = requests.post(url, headers=headers, json=data)

# 输出响应结果
if response.status_code == 200 or response.status_code == 201:
    print("请求成功:", response.json())
else:
    print(f"请求失败: 状态码 {response.status_code}, 错误信息: {response.text}")